import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int j=0;
        int i=0;
        int count=1;
        int m=n;
        int[][] arr=new int[n][n];
        while(count<=m*m){
            for(j=m-n;j<n;j++){
                arr[i][j]=count;
                count++;
            }
            if(count>m*m){
                break;
            }
            j--;
            for(i=m-n+1;i<n;i++){
                arr[i][j]=count;
                count++;
            }
            if(count>m*m){
                break;
            }
            i--;
            for(j=n-2;j>=m-n;j--){
                arr[i][j]=count;
                count++;
            }
            if(count>m*m){
                break;
            }
            j++;
            for(i=n-2;i>=m-n+1;i--){
                arr[i][j]=count;
                count++;
            }
            i++;
            n--;
        }
        for(i=0;i<m;i++){
            for(j=0;j<m;j++){
                System.out.print(arr[i][j]+" ");
            }
            System.out.println();
        }
    }
    public static void main1(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int[][] arr=new int[n][m];
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                arr[i][j]=sc.nextInt();
            }
        }
        int sum=0;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(arr[i][j]>0){
                    sum+=arr[i][j];
                }
            }
        }
        System.out.println(sum);
    }
}